package controller;

import entity.Customer;
import entity.FollowUp;
import entity.MyResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.CustomerService;
import service.FollowUpService;

import java.util.List;

@Controller
@RequestMapping("/follow")
public class FollowUpController {
    @Autowired
    public FollowUpService followUpService;
    @Autowired
    private CustomerService customerService;
    @ResponseBody
    @RequestMapping("/tracks")
    public MyResult insert(FollowUp followUp){
        boolean flag = followUpService.insert(followUp);
        return new MyResult<>(0);
    }
    @RequestMapping("/contacts")
    public String all(ModelMap modelMap){
        List<FollowUp> followUps = followUpService.selectAll();
        modelMap.addAttribute("followUps",followUps);
        return "contact.jsp";
    }

}
